<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
    <head>
        <th:block th:include="include :: header('编辑课程考试题')"/>
        <style type="text/css">
            body {
                font: 12px/1.5 "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", "Microsoft YaHei UI", "微软雅黑", sans-serif;
                color: #262626;
                font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "阿里巴巴普惠体", "思源黑体 CN", "微软雅黑", "Microsoft YaHei", sans-serif;
                word-break: break-all;
                word-wrap: break-word;
                overflow-x: hidden;
            }

            #divQType li {
                float: left;
                padding-right: 5px;
            }

            .TT-title {
                font-size: 12px;
                line-height: 18px;
                font-weight: normal;
                margin: 0 10px;
                height: 25px;
            }

            .TT-font14 {
                font-size: 14px;
                color: #0067ac;
                font-weight: bold;
            }

            .contentLeft {
                width: 49%;
                display: inline-block;
                float: left
            }

            .TT-textarea {
                height: 500px;
                width: 95%;
                overflow: auto;
                border: 1px solid #ececec;
                padding: 20px 10px 10px 10px;
                margin-top: 15px;
                display: inline-block;
                line-height: 20px;
            }

            .surveycontent {
                /*height: 500px;*/
                /*width: 48%;*/
                overflow: auto;
                border: 1px solid #ececec;
                padding: 10px;
                margin-top: 15px;
                float: left;

                display: inline-block;
            }

            .TT-sub {
                /*width:115px;
                 padding-left:580px;*/
            }

            A.TT-btn2 {
                background: #75c5f0;
                font-size: 12px;
                padding: 3px 15px;
            }

            .TT-subtn {
                color: #FFFFFF !important;
                text-align: center;
                display: inline-block;
                border: 0;
                text-decoration: none;
            }

            .TE-box2 {
                position: relative;
            }

            .clearbtn {
                position: absolute;
                top: 30px;
                right: 10px;
            }

            input.cancle {
                height: 30px;
                line-height: 30px;
                margin: 0 5px;
            }

            .dim-set__sched {
                overflow: hidden;
                margin-top: 5px;
                margin-bottom: 15px;
                width: 100%;
                background-color: #f2f4f5;
            }

            .dim-set__sched a {
                float: left;
                font-size: 16px;
                width: 140px;
                height: 40px;
                line-height: 2.5;
                color: #999;
                text-align: center;
                cursor: pointer;
            }

            .dim-set__sched a.clicked {
                color: #1ea0fa;
                background-color: #e1e3e5;
            }

            .btn {
                display: inline-block;
                padding: 0 10px;
                margin-bottom: 0;
                font-size: 12px;
                font-weight: normal;
                line-height: 1;
                text-align: center;
                white-space: nowrap;
                vertical-align: middle;
                -ms-touch-action: manipulation;
                touch-action: manipulation;
                cursor: pointer;
                -webkit-user-select: none;
                -moz-user-select: none;
                -ms-user-select: none;
                user-select: none;
                background-image: none;
                border: 1px solid transparent;
                border-radius: 6px;
            }

            .submit-btn {
                width: 100px;
                height: 32px;
                font-size: 14px;
                line-height: 30px;
                border-radius: 2px;
                margin: 0 3px;
                color: #fff;
                border: 1px solid #1ea0fa;
                background-color: #1ea0fa;
                text-align: center;
            }

            .submit-btn:hover {
                color: #fff;
                border: 1px solid #0987db;
                background-color: #0987db;
            }

            .add-btn {
                width: 100px;
                height: 32px;
                font-size: 14px;
                line-height: 30px;
                border-radius: 2px;
                margin: 0 3px;
                color: #808080 !important;
                border: 1px solid #cccccc;
                background-color: #fff;
            }

            .add-btn:hover {
                color: #808080;
                border: 1px solid #cccccc;
                background-color: #edeef0;
            }


            li {
                list-style: none;
            }

            .div_table_radio_question li {
                margin-bottom: 2px;
            }

            .div_table_radio_question li {
                display: inline-block;
                vertical-align: top;
                list-style-type: none;
            }

            ul{
                padding-left: 10px;
            }
        </style>
        <script>
            var slider_hint, slider_value, sum_hint, sum_warn, sum_total, sum_left, minTimeTip, type_radio_down = "请选择",
                type_order = "排序题",
                type_order_limit_begin = "请选择",
                type_order_limit_end = "并排序",
                type_check = "多选题",
                type_check_limit1 = "请选择",
                type_check_limit2 = "可以选择",
                type_check_limit3 = "<b>最少</b>选择",
                type_check_limit4 = "<b>最多</b>选择",
                type_check_limit5 = "项",
                type_order_all = "全部选",
                subjectInfo = "提示：",
                jump_info = "此题设置了跳转逻辑",
                page_info = "页",
                defaultOtherText = "",
                validate_email = "请输入正确的Email地址如cs@sojump.com",
                validate_phone = "请输入正确的电话号码（如：027-87789123或086-027-87789123），请注意使用英文字符格式。",
                validate_mobile = "请输入正确的手机号码（如：13812341234），请注意使用英文字符格式。",
                validate_mo_phone = "请输入正确的号码（如：13812341234或027-87789123），请注意使用英文字符格式。",
                validate_reticulation = "请输入正确的网址如：https://www.wjx.cn",
                validate_chinese = "此题只允许输入汉字，请不要输入英文和标点符号。",
                validate_english = "此题只允许输入英文字母",
                validate_englishdigit = "此题只允许输入英文字母和数字",
                validate_idcardNum = "请输入正确的身份证号（如：432123198912103118），请注意使用英文字符格式。",
                validate_num = "请输入正确的整数（如：12345678），请注意使用英文字符格式。",
                validate_decnum = "请输入正确的数字（如：12.34），请注意使用英文字符格式。",
                validate_num1 = "最大值不能超过",
                validate_num2 = "最小值不能小于",
                validate_date = "请输入正确的日期",
                validate_qq = "请输入正确的QQ号码，可以为邮箱",
                validate_only = "此题要求每个用户输入的答案都唯一，您输入的答案之前已有用户输入，请重新输入！",
                validate_list = "您输入的答案不在问卷发布者预先设定的答案列表中，请重新输入！",
                validate_error = "正在验证此题答案的正确性，请再次点击按钮！",
                validate_textbox = "文本框内容必须填写！",
                validate_submit = "请确保所有内容填写正确，页面将自动定位到第一个不符合要求的题目，请检查！",
                type_wd_limit = "字以内",
                type_wd_minlimit = "最少",
                type_wd_minlimitDigit = "最小值",
                type_wd_maxlimitDigit = "最大值",
                type_wd_digitfrom = "从",
                type_wd_words = "字",
                type_wd_to = "到",
                validate_info = "此",
                validate_info_wd1 = "请回答此题",
                validate_info_q1 = "请输入内容",
                validate_info_c1 = "请选择选项",
                validate_info_f1 = "请上传文件",
                validate_info_o1 = "请选择选项并排序",
                validate_info_wd2 = "题的填写超过了最大字数，请修改！",
                validate_info_wd3 = "您的输入已超过最大字数{0},当前字数为{1}",
                validate_info_wd4 = "您的输入小于最小输入字数{0},当前字数为{1}",
                validate_info_check1 = "题请选择",
                validate_info_check2 = "项并排序",
                validate_info_check3 = "题请选择所有选项并排序",
                validate_info_check4 = "题最多只能选择",
                validate_info_check5 = "题最少要选择",
                validate_info_matrix1 = "小题",
                validate_info_matrix2 = "题为必答题，请回答",
                validate_info_matrix3 = "！",
                validate_info_matrix4 = "题必须填写数字",
                validate_info_submit1 = "请输入验证码",
                validate_info_submit2 = "正在提交......",
                validate_info_submit8 = "很抱歉，由于网络异常您的提交没有成功，请再试一次！",
                validate_info_submit_title1 = "看不清吗？请点击刷新！",
                validate_info_submit_title3 = "点击获取验证码",
                validate_info_submit_title2 = "将本题所有选项设为未选中状态",
                type_radio_clear = "清除选择";
            validate_info_submit1 = "请输入验证码", slider_hint = "拖动或点击滑动条", slider_value = "当前滑动值为：", sum_hint = "可以拖动滑动条也可以通过文本框直接输入",
                sum_warn = "请修改！", sum_total = "提示：总比重值必须为：", sum_left = "，已分配比重：", minTimeTip = "秒后继续";
        </script>

    </head>
    <body class="white-bg">
        <div class="wrapper wrapper-content animated fadeInRight ibox-content">

            <form class="form-horizontal m" id="form-exam-edit" th:object="${bizCourseExam}">

                <div class="row">
                    <div style="height:500px;">
                        <div id="divContent" class="contentLeft">
					    <textarea name="originText" rows="2" cols="20" wrap="off" id="originText" th:field="*{originText}"
                              class="TT-textarea" style="display: none"></textarea>
                            <input type="hidden" name="examContent" id="examContent">
                        </div>
                        <div id="divQuestion" class="surveycontent">
                        </div>
                    </div>
                    <div style="height:10px;"></div>
                    <div style="text-align: center; margin-top: 58px;">
				<span id="TT-sub" class="TT-sub">
<!--					<a class="btn submit-btn" href="javascript:void(0);" onclick="submitForm()">-->
<!--						确定导入</a>-->
				</span>

                        <div class="divclear"></div>
                    </div>
                    <div id="divMsg" style="color:red;">
                        <div style="height:10px;"></div>
                    </div>
                </div>

            </form>
        </div>
        <th:block th:include="include :: footer"/>
        <script type="text/javascript">
            var prefix = ctx + "biz/exam"
            $("#form-exam-edit").validate({
                                             focusCleanup: true
                                         });

            function submitForm(){

                generateQs(1);
                if ($.validate.form()) {

                    const courseDetailId = $('input[name=courseDetailId]').val()
                    if (!courseDetailId) {
                        $.modal.msgError("请选择所属课程");
                        return false
                    }
                    let data = $('#form-exam-edit').serialize();

                    console.log(data)

                    $.operate.save(prefix + "/edit", data);
                }
            }

            function submitHandler() {
                $.modal.close();
            }

            function selectManageTree() {
                var options = {
                    title: '课程选择',
                    width: "380",
                    url: prefix + "/selectManageTree/" + $("#treeId").val(),
                    callBack: doSubmit
                };
                $.modal.openOptions(options);
            }

            function doSubmit(index, layero) {
                var tree = layero.find("iframe")[0].contentWindow.$._tree;
                if (checkL4(tree)) {
                    var body = layer.getChildFrame('body', index);
                    $("#treeId").val(+body.find('#treeId').val() + 100000);
                    $("#treeName").val(body.find('#treeName').val());
                    $('input[name=courseDetailId]').val($("#treeId").val())
                    console.log('courseDetailId = ' + $("#treeId").val())
                    layer.close(index);
                }
            }

            function checkL4(_tree) {
                var nodes = _tree.getSelectedNodes();
                if (nodes.length == 0) {
                    $.modal.msgError("请选择节点后提交");
                    return false;
                }
                for (var i = 0; i < nodes.length; i++) {
                    if (nodes[i].level != 3) {
                        $.modal.msgError("数据不正确，请选择第四级菜单");
                        return false;
                    }

                }
                return true;
            }
        </script>


    </body>
    <script type="text/javascript">
        var txtContent = document.getElementById("originText");
        var cbEnglish = document.getElementById("cbEnglish");
        var divMsg = document.getElementById("divMsg");
        var hrefHelp = document.getElementById("hrefHelp");
        var divAddHeader = document.getElementById("divAddHeader");
        var isKaoShi = 1;
    </script>
    <!-- <script type="text/javascript" src="./addqbatch.js"></script> -->
    <script type="text/javascript">
        function getbyTagName(a, b, c) {
            var d, e;
            for (e = 0; e < a.childNodes.length; e++) {
                d = a.childNodes[e], d.tagName === b && c.push(d), d.childNodes.length >
                0 && 1 == d.nodeType && getbyTagName(d, b, c)
            }
        }

        function generateQs(a) {

            var textContent, textContentLines, currentLine, e, f, g, h, nextLine, j, k, l, m, n, p, q, r, s, t, u, v, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O,
                P, Q, R, S, T, U, V, W, X, Y, Z, $, _, ab, bb, db, eb, fb, gb, hb, ib, jb, kb, lb, mb, nb, ob, pb, qb, rb, sb,
                tb, ub, vb, wb, xb, yb, zb, Ab, Bb, Cb, Db, Eb, Fb, Gb, Hb, Ib;
            if (questions.innerHTML = "", !window.txtContent.value) return window.parent.alert("请复制问卷文本到文本框里面！"), void 0;

            qlistNode = new Array
            questionHolder = new Array
            window.parent.batAddQTimes++
            textContent = window.txtContent.value

            textContent = replace_specialChar(textContent)
            lines = textContent.split("\n")
            textContentLines = lines.length
            prevDigit = -1
            e = false
            f = ""
            g = ""
            h = ""
            for (lineIndex = 0; lineIndex < textContentLines; lineIndex++) {
                currentLine = lines[lineIndex]
                nextLine = lines[lineIndex + 1]
                j = /^\s*([A-Za-z])[^A-Za-z0-9]/
                k = true, IsBlank(currentLine) && IsBlank(nextLine) || (IsBlank(currentLine) && nextLine && (l = "", m = nextLine.match(j),
                m && (l = m[1]), m && h && (m = h.match(j), m && (f = m[1])), "A" != l && "a" != l || "" != f ? f &&
                    l && l.charCodeAt(0) == f.charCodeAt(0) + 1 && (k = false, f = l, e = true) : (k = false, f = l, e = true)),
                IsBlank(currentLine) || (h = currentLine), k && (g += currentLine + "\n"));
            }
            for (e && (window.txtContent.value = textContent = g, lines = textContent.split("\n"), textContentLines = lines.length), n = "", p = "", q = false, r = !
                0, s = false, t = false, qType = "question", isDigitBig = false, u =
                /^\s*([一二三四五六七八九十][\.。、\x20\t．:：]|[（(][一二三四五六七八九十][)）]|第[一二三四五六七八九十])/g, v = 0, titleProcessed = false,
                     firstQuestion = null, lineIndex = 0, curChar = 0, lineIndex = 0; textContentLines > lineIndex; lineIndex++)
                if (currentLine = lines[lineIndex], u.exec(currentLine) && v++, v > 5) {
                    isDigitBig = true;
                    break
                } for (choiceStartWithNumber = false, prevChoiceD = 0, isCompact = false, y = false, lineIndex = 0; textContentLines >
            lineIndex; lineIndex++)
                if (currentLine = lines[lineIndex], !IsBlank(currentLine)) {
                    StartWithDigit(currentLine) && (isCompact = true, y = true);
                    break
                } try {
                for (;;) {
                    if (lineIndex >= textContentLines) break;
                    if (currentLine = trim(lines[lineIndex]), z = false, titleProcessed || (IsBlank(currentLine) || (p = currentLine, qType = "question", q = false,
                        t = false, p.contains(MatrixType) || p.contains(LikertMatrixType) || p.contains(
                        RevLikertMatrixType) || p.contains("[矩阵单选题]") ? (r = true, qType = "matrix") : p.contains(
                        TableType) ? (r = true, s = true, qType = "matrix") : p.contains(SumType) ? qType = "sum" : p
                    .contains(SortType) ? qType = "sort" : p.contains(LikertType) || p.contains(ReverseLikertType) ?
                        qType = "likert" : p.contains(CheckQType) || p.contains(CeShiQCheckType) ? qType = "check" : p
                        .contains(RadioQType) || p.contains(CeShiQType) ? qType = "radio" : p.contains(PageType) ? (
                            qType = "page", pageStartIndex = lineIndex + 1) : p.contains(GapFillType) || p.contains(
                            GapFillTest) || p.contains(CeShiJianDaType) || p.contains(kaoshiBlankType) ? qType =
                            "question" : (p.contains(CutType) || isCompact && IsCut(p)) && (qType = "cut", cutStartIndex =
                            lineIndex + 1), titleProcessed = true), lineIndex++), titleProcessed) {
                        if (A = lineIndex, B = 0, C = false, D = true, E = false, n = "", F = p.contains(GapFillType) || p.contains(
                            GapFillTest), !F)
                            for (; textContentLines > A; A++)
                                if (G = lines[A], isCompact) {
                                    if (prevIsNewQ = false, IsBlank(G)) {
                                        choiceStartWithNumber = false;
                                        break
                                    }
                                    if (isKaoShi && StartWithDigit(G)) {
                                        choiceStartWithNumber = false;
                                        break
                                    }
                                    B++
                                } else {
                                    if (IsBlank(G)) break;
                                    B++
                                } for (; A > lineIndex; lineIndex++)
                            if (G = trim(lines[lineIndex]), "cut" == qType || "page" == qType) n += lines[lineIndex], A - 1 >
                            lineIndex && (n += "<br/>"), cutEndIndex = lineIndex + 1, pageEndIndex = lineIndex + 1;
                            else if (!IsBlank(G))
                                if (C = true, "matrix" == qType)
                                    if (r) {
                                        for (H = "103", s && (H = "303", itemValue = 0), tempDataNode = AddMatrixTitle(p, qIndex,
                                                                                                                       H), qIndex++, I = G.split(/(\x20|\t)+/gi), J = 0; J < I.length; J++) isEmpty(trim(I[
                                                                                                                                                                                                             J])) || itemValue++, AddSelectItem(tempDataNode, I[J]);
                                        if (s)
                                            for (K = 1; K < tempDataNode._select.length; K++) tempDataNode._select[K]._item_value =
                                                K;
                                        r = false
                                    } else if (s) {
                                        for (I = G.split(/(\x20|\t)+/gi), J = 0; J < I.length; J++) AddColumn(tempDataNode, I[J]);
                                        s = false
                                    } else G.startWith(LabelItem) ? label = G.substr(4) : AddMatrixLine(tempDataNode, G);
                                else if ("sum" == qType) t || (tempDataNode = AddSumTitle(p, qIndex), qIndex++, t = true), t && (G
                                .startWith(LabelItem) ? label = G.substr(4) : AddMatrixLine(tempDataNode, G));
                                else if (p.match(/[\(（]?\s*([×错√对])\s*[\)）]?\s*$/) && G.match(/(答案解析[：:]|解析[：:])\s*/) && "check" !=
                                    qType && "radio" != qType && "sort" != qType && "likert" != qType) qType = "radio", tempDataNode =
                                    AddQuestion(p, qIndex), L = G.replace(/(答案解析[：:]|解析[：:])\s*/, ""), tempDataNode._ceshiDesc = L,
                                    C = false;
                                else if (p.contains(GapFillStr) && G.match(/(答案[：:]|答[：:])\s*/) && "check" != qType && "radio" !=
                                    qType && "sort" != qType && "likert" != qType && 2 > B) qType = "gapfill", tempDataNode =
                                    AddGapFill(p, qIndex, G, null), C = false;
                                else if (isKaoShi && getGapFillCount(p) > 0 && G.match(/(答案解析|解析[：:])\s*/) && "check" != qType &&
                                    "radio" != qType && "sort" != qType && "likert" != qType && 2 > B) qType = "gapfill", tempDataNode =
                                    AddGapFill(p, qIndex, null, G), C = false;
                                else if (p.contains(GapFillStr) && G.match(/(答案解析|解析[：:])\s*/) && "gapfill" == qType && null !=
                                    tempDataNode) L = G.replace(/(答案解析[：:]|解析[：:])\s*/, ""), tempDataNode._ceshiDesc = L, C = false;
                                else if (p.contains(kaoshiBlankType) && "check" != qType && "radio" != qType && "sort" != qType &&
                                    "likert" != qType) qType = "question", z || (tempDataNode = AddQuestion(p, qIndex), z = true), M =
                                    /(答案[：:])\s*/, N = null, N = G.match(M), O = /(解析[：:])\s*/, P = null, P = G.match(O), N ?
                                    processQuesAnswer(tempDataNode, false, G) : P && processQuesAnswer(tempDataNode, true, G), C = false;
                                else {
                                    if ("sort" != qType && "likert" != qType && "check" != qType && "radio" != qType && (qType =
                                        "radio", isCheck(p) && (qType = "check")), Q = false, !q) {
                                        if (Q = false, !Q) {
                                            if (E = ContainsAB(G, lines, lineIndex, A), E && !isKaoShi)
                                                for (R = G.toUpperCase(), curChar = 65; 90 > curChar && (S = String.fromCharCode(
                                                    curChar), T = String.fromCharCode(curChar + 1), U = R.indexOf(S), V = R
                                                .indexOf(T), U > -1 && V > -1); curChar++) numPerNow++;
                                            else if (1 == B && isCompact && !isEnglish && !isKaoShi)
                                                if (W = /□|○|①|②|③|④|⑤|⑥|⑦|⑧/gi, I = G.split(W), I.length >= 3) numPerNow = I.length -
                                                    1;
                                                else if (I = G.split(/(\d\d?\.|\d\d?、|\(\d\d?\)|（\d\d?）)/gi), I.length < 4 && (I = G
                                                .split(/(\x20|\t)+/gi)), I.length < 3) {
                                                    if (!(p.contains(RadioQType) || p.contains(CeShiQType) || p.contains(
                                                        CeShiQCheckType))) {
                                                        qType = "question", C = false;
                                                        break
                                                    }
                                                    numPerNow = 6
                                                } else numPerNow = (I.length + 1) / 2;
                                            tempDataNode = AddSelectTitle(p, qIndex, qType)
                                        }
                                        itemValue = 0, qIndex++, q = true
                                    }
                                    if (q && !Q)
                                        if (G.startWith(LabelItem)) label = G.substr(4);
                                        else {
                                            if (("radio" == qType || "likert" == qType) && itemValue++, I = null, X = false, isCompact)
                                                if (D && (E = ContainsAB(G, lines, lineIndex, A), D = false, curChar = 65), E) {
                                                    if (R = G.toUpperCase(), Y = null, Y = isKaoShi ? R.match(/[A-Z]{2,}/gi) : R.match(
                                                        /[A-Z][A-Z0-9\-]{1,}/gi))
                                                        for (Z = 0; Z < Y.length; Z++) {
                                                            for ($ = Y[Z].length, _ = "", ab = 0; $ > ab; ab++) _ += "*";
                                                            R = R.replace(Y[Z], _)
                                                        }
                                                    for (bb = ""; 90 > curChar; curChar++)
                                                        if (S = String.fromCharCode(curChar), T = String.fromCharCode(curChar + 1), db =
                                                            String.fromCharCode(curChar - 1), U = R.indexOf(S), V = R.indexOf(T), eb = R
                                                        .indexOf(db), fb = -1, gb = trim(G).match(/^答?案?\s*解析[\:：\s]/), isKaoShi &&
                                                        gb || (fb = R.indexOf("其它"), -1 == fb && (fb = R.indexOf("其他"))), -1 == V &&
                                                        (T = String.fromCharCode(curChar + 2), V = R.indexOf(T), V > -1 &&
                                                        curChar++), U > -1 && V > -1) bb = G.substring(U, V), AddSelectItem(
                                                            tempDataNode, bb);
                                                        else if (U > -1) bb = G.substring(U), AddSelectItem(tempDataNode, bb);
                                                        else {
                                                            if (fb > -1 && -1 == eb) {
                                                                bb = G.substring(fb), AddSelectItem(tempDataNode, bb);
                                                                break
                                                            }
                                                            if (!(-1 == U && V > -1)) break;
                                                            bb = G.substring(fb), AddSelectItem(tempDataNode, bb), curChar++
                                                        }
                                                    isKaoShi && !bb && (hb = false, G.indexOf("答案") > -1 && -1 == G.indexOf("解析") && (
                                                        hb = true), ib = G.match(/([A-Z]+)/), ib && ib[1] ? AddSelectItem(
                                                        tempDataNode, G) : (gb = trim(G).match(/^答?案?\s*解析[\:：\s]/), gb &&
                                                    AddSelectItem(tempDataNode, G))), X = true
                                                } else if (!isEnglish && !isKaoShi && (W = /(□|○|①|②|③|④|⑤|⑥|⑦|⑧)/gi, I = G.split(W),
                                                    jb = false, kb = 1, I.length < 4 && (I = G.split(
                                                    /(\d\d?\.|\d\d?、|\(\d\d?\)|（\d\d?）)/gi), I.length < 4 && (I = G.split(
                                                    /(\x20|\t)+/gi), jb = true, kb = 0)), I.length > 1))
                                                    for (X = true, J = kb; J < I.length; J++) jb ? AddSelectItem(tempDataNode, I[J]) : (
                                                        AddSelectItem(tempDataNode, I[J] + I[J + 1]), J++);
                                            X || AddSelectItem(tempDataNode, G)
                                        }
                                }
                        if (C) {
                            if (tempDataNode._endLine = lineIndex, p.contains(LikertType) || p.contains(ReverseLikertType) || p
                            .contains(LikertMatrixType) || p.contains(RevLikertMatrixType))
                                for (lb = p.contains(RevLikertMatrixType) || p.contains(ReverseLikertType), mb = 1, lb && (mb =
                                    tempDataNode._select.length - 1), K = 1; K < tempDataNode._select.length; K++)
                                    tempDataNode._select[K]._item_value = mb, lb ? mb-- : mb++;
                            else if (p.contains(CeShiQType) || p.contains(CeShiQCheckType) || isKaoShi) {
                                if (tempDataNode._hasvalue = true, tempDataNode._isCeShi = true, tempDataNode._ceshiDesc = "",
                                    tempDataNode._ceshiValue = 5, nb = /\,\s*\[\s*(\d+)秒\]\s*$/, ob = tempDataNode._title.match(
                                    nb), ob && ob[1] && (tempDataNode._title = tempDataNode._title.replace(nb, "")), pb =
                                    /[\(（\[]?\s*(\d+)分[\)）\]]?\s*$/, ob = tempDataNode._title.match(pb), ob && ob[1] && (
                                    tempDataNode._ceshiValue = parseInt(ob[1]) || 5, tempDataNode._title = tempDataNode
                                    ._title.replace(pb, "")), qb = /[\(（]\s*(答案[：:])?\s*([A-L、]+)\s*[\)）]/, rb = false, N =
                                    tempDataNode._title.match(qb), sb = false, tb = tempDataNode._select.length, N && N[2]) {
                                    for (ub = N[2].replace(/、/g, ""), K = 1; tb > K; K++)
                                        for (vb = trim(tempDataNode._select[K]._item_title), wb = 0; wb < ub.length; wb++)
                                            if (vb.startWith(ub[wb])) {
                                                tempDataNode._select[K]._item_radio = true, rb = true, sb = true;
                                                break
                                            } rb || 1 != ub.length || "B" != ub[0] && "A" != ub[0] || 3 != tempDataNode._select
                                        .length || (rb = true, xb = 1, sb = true, "B" == ub[0] && (xb = 2), tempDataNode._select[xb]
                                        ._item_radio = true), ub.length > 1 && (tempDataNode._type = "check")
                                } else {
                                    for (yb = 0, K = 1; K < tempDataNode._select.length; K++) vb = trim(tempDataNode._select[K]
                                                                                                            ._item_title), (vb.contains("（正确答案）") || vb.contains("(正确答案)")) && (tempDataNode
                                        ._select[K]._item_radio = true, yb++, tempDataNode._select[K]._item_title = vb
                                    .replace("（正确答案）", "").replace("(正确答案)", ""), rb = true);
                                    yb > 1 && "radio" == tempDataNode._type && (tempDataNode._type = "check")
                                }
                                if (tb > 2 && (zb = /^答?案?\s*解析[\:：\s]/, Ab = trim(tempDataNode._select[tb - 1]._item_title),
                                        Bb = tempDataNode._select[tb - 2]._item_title, Cb = false, vb.match(zb) && (tempDataNode
                                        ._ceshiDesc = Ab.replace(zb, ""), tempDataNode._select.pop(), Cb = true), M =
                                        /([A-Z]+)/, N = null, hb = false, Db = Ab, Cb && (Db = Bb), Db.indexOf("答案") > -1 && -1 ==
                                    Db.indexOf("解析") && (N = Db.match(M)), N && N[1] && (tempDataNode._select.pop(), !rb)
                                )) {
                                    for (ub = N[1], K = 1; K < tempDataNode._select.length; K++)
                                        for (vb = trim(tempDataNode._select[K]._item_title), wb = 0; wb < ub.length; wb++)
                                            if (vb.startWith(ub[wb])) {
                                                tempDataNode._select[K]._item_radio = true, rb = true;
                                                break
                                            } rb || 1 != ub.length || "B" != ub[0] && "A" != ub[0] || 3 != tempDataNode._select
                                        .length || (rb = true, xb = 1, "B" == ub[0] && (xb = 2), tempDataNode._select[xb]
                                        ._item_radio = true), ub.length > 1 && (tempDataNode._type = "check")
                                }
                                for (rb ? sb && (tempDataNode._title = tempDataNode._title.replace(qb, "（）")) : tempDataNode
                                    ._select[1]._item_radio = true, Eb = 0, Fb = 0, Gb = 0, K = 1; K < tempDataNode._select
                                    .length; K++) vb = trim(tempDataNode._select[K]._item_title), vb.match(/^[A-Z]/) ? (0 ==
                                Gb && (Gb = K), Eb++) : Fb = K;
                                if (Fb > 0 && 1 == Gb - Fb && Eb >= 2) {
                                    for (Hb = "", K = 1; Fb >= K; K++) Hb += "<br/>" + tempDataNode._select[K]._item_title;
                                    tempDataNode._title = tempDataNode._title + Hb, tempDataNode._select.splice(1, Fb)
                                }
                            }
                            tempDataNode._select && tempDataNode._numperrow >= tempDataNode._select.length && (tempDataNode
                                ._numperrow = tempDataNode._select.length - 1), createQ(tempDataNode), tempDataNode = null
                        } else if ("cut" == qType || "page" == qType) n = isEmpty(n) ? p : p + "<br/>" + n, tempDataNode =
                            "cut" == qType ? AddCut(n) : AddPage(n), createQ(tempDataNode);
                        else if ("question" == qType && p.contains(kaoshiBlankType) && tempDataNode) tempDataNode._ceshiValue ||
                        (tempDataNode._ceshiValue = 5), createQ(tempDataNode), qIndex++, tempDataNode = null;
                        else if ("question" == qType) {
                            if (1 == B)
                                for (; A > lineIndex; lineIndex++) G = lines[lineIndex], IsBlank(G) || (p += G);
                            tempDataNode = AddQuestion(p, qIndex), tempDataNode._ceshiValue || (tempDataNode._ceshiValue = 5),
                                createQ(tempDataNode), qIndex++, tempDataNode = null
                        } else("gapfill" == qType || "radio" == qType) && (createQ(tempDataNode), qIndex++, tempDataNode =
                            null);
                        titleProcessed = false
                    }
                }
                createQBatch(a)
            } catch (Jb) {
                console.log('------异常-----')
                console.log(Jb)
                return divMsg.innerHTML =
                    "<div style='height:10px;'></div>问卷格式不对",
                isKaoShi && (divMsg.innerHTML =
                        "<div style='height:10px;'></div>问卷格式不对"
                ), void 0
            }
        }

        function clearTxt() {
            generateQs()
        }

        function createQ(a) {
            qlistNode.push(a)
            console.log('-------createQ 问题列表------')
            console.log(qlistNode)
        }



        function create_question(a) {

            var f, g, h, i, j, k, l, m, n, o, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q,
                R, S, T, U, V, W, X, Y, Z, b = a._type;
            return a._verify, a._height > 1, _likertMode = a._tag || 0, f = document.createElement("div"), f.className =
                "div_question", f.dataNode = a, g = $ce("div", "", f), g.className = "div_preview", f.div_question_preview = g,
                h = "question" == b, i = "slider" == b, j = "sum" == b, k = "page" == b, l = "cut" == b, m = "check" == b, n =
                "radio" == b, o = n && _likertMode, q = "radio_down" == b, r = "matrix" == b, s = "matrix" == b && _likertMode >
                300, t = m && _likertMode, u = "fileupload" == b, v = n || q || m || r, w = !l && !k, x = "gapfill" == b, y =
                document.createElement("div"), w && (z = $ce("div", a._topic + ".", y), f.divTopic = z, z.className =
                "div_topic_question", z.style.display = "none"), k && (A = a._iszhenbie, z = $ce("span",
                                                                                                 "<span style='font-size:14px; font-weight:bold;'>第" + a._topic + "页/共" + total_page + "页</span>", y), z
                .className = "div_topic_page_question", f.divTopic = z, f.divZhenBie = $ce("span",
                                                                                           "<b style='color:red;'>--甄别页</b>", y), f.divZhenBie.style.display = A ? "" : "none", f.divTimeLimit =
                $ce("span", "", y), f.showTimeLimit = function () {
                var a = "";
                this.dataNode._mintime && (a = "最短填写时间：" + this.dataNode._mintime + "秒"), this.dataNode._maxtime && (
                    a && (a += "&nbsp;"), a += "最长填写时间：" + this.dataNode._maxtime + "秒"), a && (a =
                    "&nbsp;&nbsp;<b style='color:green;'>--" + a + "</b>"), f.divTimeLimit.innerHTML = a
            }, f.showTimeLimit(), "1" == a._topic && (f.style.display = "none"), "1" == a._topic && (isPrevFirstPage = !
                0)), l && (y.className = "div_title_cut_question"), w && (y.className = "div_title_question_all"), B =
                $ce("div", "", y), C = a._title, x && (C = replaceGapFill(C, a)), D = $ce("span", C, B), B.className = k ?
                "div_title_page_question" : "div_title_question", f.get_div_title = function () {
                return D
            }, w && (E = $ce("span", "&nbsp;*", B), E.style.color = "red", E.style.display = a._requir ? "" : "none", f
                .get_span_required = function () {
                return E
            }, h && (F = $ce("span", "", B), F.className = "font-a0", f.showMinMaxWord = function (a, b) {
                var c = this.dataNode,
                    d = "",
                    e = type_wd_words,
                    f = type_wd_minlimit;
                ("数字" == c._verify || "小数" == c._verify) && (e = "", f = type_wd_minlimitDigit, d =
                    type_wd_digitfrom), isEmpty(a) || isEmpty(b) ? isEmpty(a) ? isEmpty(b) ? F.style.display =
                    "none" : (F.innerHTML = "&nbsp;（" + f + b + e + "）", F.style.display = "") : (F.innerHTML =
                    "&nbsp;（" + a + type_wd_limit + "）", ("数字" == c._verify || "小数" == c._verify) && (F
                    .innerHTML = "&nbsp;（" + type_wd_maxlimitDigit + a + "）"), F.style.display = "") : (F
                    .innerHTML = "&nbsp;（" + d + b + type_wd_to + a + e + "）", F.style.display = "")
            }, f.showMinMaxWord(a._maxword, a._minword), f.get_span_maxword = function () {
                return F
            }, a._isCeShi && a._answer && (G = $ce("span", "", B), G.style.color = "#efa030", f.spanCeShi = G)), a
                ._isCeShi && (h || n || m) && (G = $ce("span", "", B), G.style.color = "#efa030", h ? (H = "答案：" + (a
                ._answer || "无"), "简答题无答案" == a._answer && (H = "无标准答案需人工评分"), G.innerHTML = "（" + H + "，分值：" +
                (a._ceshiValue || 5) + "分）") : G.innerHTML = "（分值：" + a._ceshiValue + "分）", f.spanCeShi = G), m ? (I =
                document.createElement("span"), f.updateSpanCheck = function () {
                var a = this.dataNode;
                a._lowLimit = a._lowLimit || "", a._upLimit = a._upLimit || "", t ? I.innerHTML = "" != a
                    ._lowLimit && -1 != a._lowLimit ? "&nbsp;[" + type_order_limit_begin + "<b>" + a._lowLimit +
                    "</b>" + type_order_limit_end + "]" : "&nbsp;[" + type_order + "]" : "" != a._lowLimit && "" !=
                a._upLimit ? I.innerHTML = a._lowLimit == a._upLimit ? "&nbsp;[" + type_check_limit1 + "<b>" + a
                    ._lowLimit + "</b>" + type_check_limit5 + "]" : "&nbsp;[" + type_check_limit2 + "<b>" + a
                    ._lowLimit + "</b>-<b>" + a._upLimit + "</b>" + type_check_limit5 + "]" : "" != a._lowLimit ? I
                    .innerHTML = "&nbsp;[" + type_check_limit3 + "<b>" + a._lowLimit + "</b>" + type_check_limit5 +
                    "]" : "" != a._upLimit ? I.innerHTML = "&nbsp;[" + type_check_limit4 + "<b>" + a._upLimit +
                    "</b>" + type_check_limit5 + "]" : a._isTouPiao || a._isCeShi || a._isCePing || (I.innerHTML =
                    "&nbsp;[" + type_check + "]"), I.className = "font-06f"
            }, f.updateSpanCheck(), B.appendChild(I)) : s ? (I = $ce("span", "", B), f.updateSpanCheck =
                function () {
                    "301" == this.dataNode._tag && "" !== this.dataNode._minvalue && "" !== this.dataNode._maxvalue ? (I
                        .innerHTML = "&nbsp;[输入" + this.dataNode._minvalue + "到" + this.dataNode._maxvalue + "的数字]",
                        I.className = "font-06f") : I.innerHTML = "", I.style.display = "301" == this.dataNode
                        ._tag ? "" : "none"
                }, f.updateSpanCheck()) : r && ("102" == a._tag || "103" == a._tag) && (J = $ce("span", "", B), f
                .updateSpanMatrix = function () {
                if (a._daoZhi) {
                    var b = "竖向单选";
                    "102" == a._tag && (b = "竖向多选"), J.innerHTML = "&nbsp;[" + b + "]", J.className = "font-06f"
                } else J.innerHTML = ""
            }, f.updateSpanMatrix())), K = $ce("div", "", y), K.style.clear = "both", g.appendChild(y), w && (L =
                document.createElement("div"), L.className = "div_table_radio_question", M = $ce("div", "", L), M
                .className = "div_table_clear_top", g.appendChild(L)), h && (N = control_textarea("1", "50"), L.appendChild(
                N), O = null, P = document.createElement("span"), L.appendChild(P), P.style.display = "none", O =
                document.createElement("span"), O.className = "design-icon design-date", L.appendChild(O), O.style.display =
                "none", N.style.overflow = "hidden", N.value = a._default, f.showTextAreaUnder = function () {
                N.className = this.dataNode._underline ? "underline" : "inputtext"
            }, f.showTextAreaWidth = function () {
                N.style.width = isEmpty(this.dataNode._width) ? "62%" : this.dataNode._width + "px"
            }, f.showTextAreaHeight = function () {
                N.style.height = 22 * this.dataNode._height + "px"
            }, f.showTextAreaDate = function () {
                var b, a = this.dataNode._verify;
                "日期" == a || "生日" == a || "入学时间" == a ? (N.style.width = "100px", N.style.height = "18px", O.style
                    .display = "", P.style.display = "none") : "城市单选" == a || "城市多选" == a || "省市区" == a ? (b =
                    "100px", "城市多选" == a ? b = "400px" : "省市区" == a && (b = "250px"), N.style.width = b, N.style
                    .height = "18px", P.innerHTML =
                    "&nbsp;<img src='/Images/Mysojump/QuestionnaireMng/Design/city.gif' alt=''/>", P.style.display =
                    "", O.style.display = "none") : (O.style.display = "none", P.style.display = "none", this
                .showTextAreaWidth(), this.showTextAreaHeight())
            }, f.showTextAreaUnder(), f.showTextAreaWidth(), f.showTextAreaHeight(), f.showTextAreaDate(), f
                .get_textarea = function () {
                return N
            }, a._isCeShi && a._ceshiDesc && (Q = document.createElement("div"), Q.style.color = "#666", Q.style
                .margin = "3px 0 3px 6px", Q.innerHTML = "答案解析：" + a._ceshiDesc, L.appendChild(Q))), u && (R = document
            .createElement("input"), R.type = "file", S = document.createElement("input"), S.type = "button", S.value =
                "上传", L.appendChild(R), $ce("span", "&nbsp;&nbsp;", L), L.appendChild(S), T = $ce("div", "请选择上传文件", L), f
                .updateFileUpload = function () {
                R.width = a._width, T.innerHTML = a._ext ? "请选择上传文件，扩展名为" + a._ext : "请选择上传文件，扩展名为" + defaultFileExt
            }, f.updateFileUpload()), x && a._isCeShi && a._ceshiDesc && (Q = document.createElement("div"), Q.style
                .color = "#666", Q.style.margin = "3px 0 3px 6px", Q.innerHTML = "答案解析：" + a._ceshiDesc, L.appendChild(Q)),
            i && (U = $ce("span", a._minvaluetext || "", L), U.className = "spanLeft", U.style.color = "red", f
                .get_span_min_value_text = function () {
                return U
            }, V = $ce("span", "(" + (a._minvalue || 0) + ")", L), V.className = "spanLeft", V.style.color = "red", f
                .get_span_min_value = function () {
                return V
            }, W = $ce("span", "(" + (a._maxvalue || 100) + ")", L), W.className = "spanRight", W.style.color = "red", f
                .get_span_max_value = function () {
                return W
            }, X = $ce("span", a._maxvaluetext || "", L), X.className = "spanRight", X.style.color = "red", f
                .get_span_max_value_text = function () {
                return X
            }, $ce("div", "", L).className = "divclear", O = control_image("/Images/WJX/JoinQuestionnaire/slider1.jpg"),
                O.style.width = "10px", Y = control_image("/Images/WJX/JoinQuestionnaire/sliderEnd.jpg"), Y.style.width =
                "97%", Y.style.height = "23px", L.appendChild(O), L.appendChild(Y), $ce("div", "", L).className =
                "divclear", L.style.width = "60%", N = control_textarea("1", "10"), N.style.display = "none"), j && (f
                .createSum = function () {
                var c, d, e, f, g, h, b = new StringBuilder;
                if (b.append("<div  class='div_table_clear_top'></div>"), this._referDivQ) b.append("此题行标题来源于第" + this
                    ._referDivQ.dataNode._topic + "题的选中项");
                else {
                    for (b.append("<table style='width:100%;' border='0px'  cellpadding='5' cellspacing='0'>"), c = "",
                             d = "", b.append("<tbody>"), e = new Array, e = trim(a._rowtitle).split("\n"), f = "", g =
                        0; g < e.length; g++) g == e.length - 1 && (c = "", d = ""), e[g].length > 4 && "【标签】" == e[g]
                    .substr(0, 4) ? (h = e[g].substr(4), b.append("<tr><th><b style='color:#0066ff;'>" + h +
                                                                      "</b></th><td></td></tr>"), f = "padding-left:10px;") : ("" == a._rowwidth ? b.append(
                        "<tr><th style='" + d + f + "'>" + e[g] + "</th>") : b.append("<tr><th style='width:" +
                                                                                          a._rowwidth + ";" + d + f + "'>" + e[g] + "</th>"), b.append("<td  " + c +
                                                                                                                                                           "align='left' width='36'><input  type='text' style='width:36px;'/></td>"), b.append(
                        "<td  " + c +
                        "align='left'><img src='/Images/WJX/JoinQuestionnaire/slider1.jpg' style='width: 10px;'/><img src='/Images/WJX/JoinQuestionnaire/sliderEnd.jpg' style='width:250px;height: 23px;'/></td>"
                    ), b.append("</tr>"));
                    b.append("</tbody></table>")
                }
                b.append("<div style='margin-top:10px;'><span style='color:#666666;'>" + sum_hint + "</span></div>"), L
                    .innerHTML = b.toString("")
            }, f.createSum()), v && (f.createTableRadio = function () {
                var j, k, l, p, s, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, M, N, O, P, Q, R, S, T, U, V, W,
                    X, Y, a = this.dataNode,
                    c = a._isTouPiao,
                    d = a._isCeShi,
                    e = a._isCePing,
                    f = a._numperrow ? a._numperrow : 1,
                    g = a._select,
                    h = a._tag,
                    i = null;
                if (c) {
                    for (i = new Array, j = g.length - 1, k = 0, l = 1; j >= l; l++) k += l;
                    for (l = 1; j >= l; l++) i[l - 1] = 100 / k * l
                }
                if (p = new StringBuilder, p.append("<div  class='div_table_clear_top'></div>"), this._referDivQ) s =
                    "选项", ("matrix" == a._type || "sum" == a.type) && (s = "行标题"), p.append("此题" + s + "来源于第" + this
                    ._referDivQ.dataNode._topic + "题的选中项");
                else {
                    if (q) {
                        for (p.append("<select><option>" + type_radio_down + "</option>"), l = 1; l < g.length; l++) g[
                            l]._item_radio ? p.append("<option selected='selected'>" + trim(g[l]._item_title) +
                                                          "</option>") : p.append("<option>" + trim(g[l]._item_title) + "</option>");
                        p.append("</select>")
                    }
                    if (n || m && !t) {
                        for (p.append("<ul>"), v = "%", o ? (u = 40, v = "px", f = 1, 101 == h && (u = 105)) : u = 100 /
                            f - 1, w = false, x = 1, l = 1; l < g.length; l++) "radio" == b && h >= 1 && 101 != h && 1 ==
                        l && (y = "0px", h > 1 && (y = "5px"), p.append(
                            "<li class='notchoice' style='padding-right:15px;padding-top:" + y + "'><b>" + g[1]
                                ._item_title + "</b></li>")), n && h > 1 && 101 != h ? l == g.length - 1 ? p.append(
                            "<li style='padding-left:3px;' class='design-icon design-off" + a._tag + "'  ></li>") :
                            p.append("<li  style='padding-left:3px;' class='design-icon design-on" + a._tag +
                                         "'  ></li>") : (g[l]._item_label && (w && p.append("</ul></li>"), p.append(
                            "<li style='width:100%;'><div><b>" + g[l]._item_label + "</b></div><ul>"), w = !
                            0, x = 1), l == g.length - 1 ? p.append("<li>") : p.append("<li  style='width:" +
                                                                                           u + v + ";'>"), g[l]._item_img ? (p.append(
                            "<table cellpadding='0' cellspacing='0'><tr><td valign='top'>"), n ? p.append(
                            "<input type='radio'") : p.append("<input type='checkbox'"), "radio" == b && g[
                            l]._item_radio && p.append(" checked='checked'"), "check" == b && g[l]
                            ._item_radio && p.append(" checked='checked'"), "radio" == b && 1 == h ? p.append(
                            "'/>" + trim(g[l]._item_value)) : p.append("'/>"), p.append("</td><td>"), g[l]
                            ._item_imgtext ? (p.append("<div style='text-align:center;'><img src='" + g[l]
                            ._item_img + "' alt='' />"), p.append(trim(g[l]._item_title)), p.append(
                            "</div></td>")) : p.append("<div><img src='" + g[l]._item_img +
                                                           "' alt='' /></div></td>"), p.append("</tr>"), g[l]._item_desc && (p.append(
                            "<tr><td></td><td>"), p.append("<div class='div_item_desc'>" + g[l]
                            ._item_desc + "</div>"), p.append("</td></tr>")), c && (p.append(
                            "<tr><td></td><td align='center'>"), addTouPiao(p, a, i, l), p.append(
                            "</td></tr>")), p.append("</table>")) : (c ? p.append(
                                "<div style='float:left;width:" + a._touPiaoWidth + "%;'>") : d && g[l]
                                ._item_radio && p.append("<span style='color:#efa030;'>"), n ? p.append(
                                "<input type='radio'") : p.append("<input type='checkbox'"), "radio" == b && g[
                                l]._item_radio && p.append(" checked='checked'"), "check" == b && g[l]
                                ._item_radio && p.append(" checked='checked'"), "radio" == b && 1 == h ? p.append(
                                "/>" + trim(g[l]._item_value)) : p.append("/>" + trim(g[l]._item_title)), c ? (p
                            .append("</div>"), p.append("<div style='float:left;'>"), addTouPiao(p, a, i,
                                                                                                 l), p.append("</div><div style='clear:both;'></div>")) : d && g[l]._item_radio ?
                                p.append("&nbsp;(正确答案)</span>") : e && p.append(
                                "<span style='color:#efa030;'>&nbsp;(分值：" + g[l]._item_value + ")</span>"), a
                                ._hasjump && a._anytimejumpto < 1 && (z = "跳转到下一题", "1" == g[l]._item_jump ? z =
                                "结束作答" : g[l]._item_jump - 1 > 0 && (z = "跳转到第" + g[l]._item_jump + "题"), p
                            .append("<span style='color:#efa030;'>&nbsp;(" + z + ")</span>")), g[l]
                                ._item_desc && p.append("<div class='div_item_desc'>" + g[l]._item_desc + "</div>")
                        ), g[l]._item_tb && p.append(
                            " <input type='text' class='underline' style='color:#999999;' value='" +
                            defaultOtherText + "'/>"), g[l]._item_tbr && p.append(
                            " <span style='color: red;'> *</span>"), p.append("</li>")), n && h >= 1 && 101 !=
                        h && l == g.length - 1 && (y = "0px", h > 1 && (y = "5px"), p.append(
                            "<li  class='notchoice'  style='padding-left:15px;padding-top:" + y + "'><b>" + g[g
                                .length - 1]._item_title + "</b></li>")), f > 1 && 0 == x % f && p.append(
                            "<div style='clear:both;'></div></ul><ul>"), x++;
                        p.append("<div style='clear:both;'></div></ul>"), w && p.append("</li></ul>"), d && a
                            ._ceshiDesc && p.append("<div style='color:#666;margin:3px 0 3px 6px;'>答案解析：" + a
                            ._ceshiDesc + "</div>")
                    }
                    if (t) {
                        for (p.append("<div><ul>"), u = 100 / f, l = 1; l < g.length; l++) p.append(
                            "<li style='float:none;margin-bottom:6px;padding:3px 0;'><input type='checkbox' style='display:none;' /><span class='sortnum'></span>" +
                            trim(g[l]._item_title) + "</li>");
                        p.append("</ul>")
                    }
                    if (r) {
                        if (A = a._daoZhi, B = "100%", a._mainWidth && (B = a._mainWidth + "%"), p.append(
                            "<table style='width:" + B + ";' border='0px'  cellpadding='5' cellspacing='0'>"), C =
                            "", D = "", E = "radio", F = new Array, F = trim(a._rowtitle).split("\n"), G = trim(a
                                                                                                                    ._rowtitle2).split("\n"), H = false, I = "", 0 == h || h > 100 && 200 > h || h > 300) {
                            if (p.append("<thead><tr><th></th>"), h > 300)
                                for (J = trim(a._columntitle).split("\n"), l = 0; l < J.length; l++) p.append(
                                    "<td align='center'>" + trim(J[l]) + "</td>");
                            else if (A)
                                for (l = 0; l < F.length; l++) F[l].length > 4 && "【标签】" == F[l].substr(0, 4) || p
                                .append("<td align='center'>" + trim(F[l]) + "</td>");
                            else
                                for (l = 1; l < g.length; l++) p.append("<td align='center'>" + trim(g[l]._item_title) +
                                                                            "</td>");
                            D = "border-bottom:1px solid #efefef;", C = "style='" + D + "'", p.append("</tr></thead>"),
                            102 == h && (E = "checkbox")
                        }
                        if (301 == h && (E = "text"), p.append("<tbody>"), "202" == h && (K = a._minvalue, M = a
                            ._maxvalue, p.append(
                            "<tr><th></th><td align='left' width='410'><table width='100%'><tr><td width='60%'><div style='width:70%'><div style='float:left;color:red;'>" +
                            K + "</div><div style='float:right;color:red;'>" + M +
                            "</div><div style='clear:both;'></div></div></td></tr></table></td><th></th>")), A)
                            for (l = 1; l < g.length; l++) {
                                for (l == g.length - 1 && (C = "", D = ""), "" == a._rowwidth ? p.append(
                                    "<tr><th style='" + D + I + "'>" + trim(g[l]._item_title) + "</th>") : p.append(
                                    "<tr><th style='width:" + a._rowwidth + ";" + D + I + "'>" + trim(g[l]
                                                                                                          ._item_title) + "</th>"), X = 0; X < F.length; X++) F[X].length > 4 &&
                                "【标签】" == F[X].substr(0, 4) || p.append("<td  " + C +
                                                                            "align='center'><input  type='" + E + "'/></td>");
                                p.append("</tr>")
                            } else
                            for (N = 0, O = false, P = "", l = 0; l < F.length; l++)
                                if (l == F.length - 1 && (C = "", D = ""), P = O ? "background:#EFF6FB;" : "", F[l]
                                    .length > 4 && "【标签】" == F[l].substr(0, 4)) Q = F[l].substr(4), p.append(
                                    "<tr style='" + P + "'><th><b style='color:#0066ff;'>" + Q +
                                    "</b></th><td colspan='" + g.length + "'></td>"), H = true, I =
                                    "padding-left:10px;", O = !O, P = O ? "background:#EFF6FB;" : "";
                                else {
                                    if ("" == a._rowwidth ? p.append("<tr style='" + P + "'><th style='" + D + I +
                                                                         "'>" + F[l] + "</th>") : p.append("<tr style='" + P +
                                                                                                               "'><th style='width:" + a._rowwidth + ";" + D + I + "'>" + F[l] +
                                                                                                               "</th>"), 100 > h && h && p.append("<td><ul>"), h > 200 && 300 > h)
                                        201 == h ? (R = a._rowVerify && a._rowVerify[l] ? a._rowVerify[l]._verify :
                                            "", S = "", T = a._rowVerify && a._rowVerify[l] ? a._rowVerify[l]
                                            ._width : "", T && (T = "width:" + T + "%"), "日期" == R ? S =
                                            "<span class='design-icon design-date'></span>" : ("城市单选" == R ||
                                            "城市多选" == R || "省市区" == R) && (S =
                                                "&nbsp;<img src='/Images/Mysojump/QuestionnaireMng/Design/city.gif' alt=''/>"
                                        ), p.append("<td  " + C +
                                                        "align='left'><textarea class='inputtext' style='overflow:auto;height:18px;" +
                                                        T + "'></textarea>" + S + "</td>")) : 202 == h && p.append("<td  " +
                                                                                                                       C +
                                                                                                                       "align='left' width='60%'><img src='/Images/WJX/JoinQuestionnaire/slider1.jpg' style='width: 10px;'/><img src='/Images/WJX/JoinQuestionnaire/sliderEnd.jpg' style='width:284px;height: 23px;'/></td>"
                                        );
                                    else if (h > 300) {
                                        if (U = "", "303" == h) {
                                            for (U += "<select><option>" + type_radio_down + "</option>", V = 1; V <
                                            g.length; V++) U += "<option>" + trim(g[V]._item_title) +
                                                "</option>";
                                            U += "</select>"
                                        }
                                        for (J = trim(a._columntitle).split("\n"), W = Number(300 / J.length), X =
                                            0; X < J.length; X++) "303" == h ? p.append("<td  " + C +
                                                                                            "align='center'>" + U + "</td>") : ("301" == h && (W = "30"), p
                                        .append("<td  " + C +
                                                    "align='center'><textarea  type='text' style='overflow:auto;height:18px;width:" +
                                                    W + "px;'></textarea></td>"))
                                    } else
                                        for (X = 1; X < g.length; X++) h > 100 || 0 == h ? p.append("<td  " + C +
                                                                                                        "align='center'><input  type='" + E + "'/></td>") : X == g.length -
                                        1 ? p.append(
                                            "<li style='padding-left:3px;' class='design-icon design-off" + h +
                                            "'></li>") : p.append(
                                            "<li style='padding-left:3px;' class='design-icon design-on" + a
                                                ._tag + "'></li>");
                                    100 > h && h && p.append("</ul></td>"), Y = "", N < G.length && (Y = G[N]),
                                        "" == a._rowwidth2 ? p.append("<th " + C + ">" + Y + "</th>") : p.append(
                                            "<th style='width:" + a._rowwidth2 + ";" + D + "'>" + Y + "</th>"), p
                                    .append("</tr>"), O = !O, N++
                                } p.append("</tbody></table>")
                    }
                }
                p.append("<div class='div_table_clear_bottom'></div>"), L.innerHTML = p.toString("")
            }, f.createTableRadio(true)), Z = document.createElement("div"), Z.className = "div_ins_question", Z.style
                .paddingBottom = "6px", Z.style.paddingTop = "6px", Z.innerHTML = a._ins ? subjectInfo + a._ins : "", g
            .appendChild(Z), f.div_ins_question = Z, cancelInputClick(f), f
        }

        function trim(a) {
            return a && a.replace ? a.replace(/(^[\s\u3000]*)|([\s\u3000]*$)/g, "") : a
        }

        function toInt(a) {
            return parseInt(trim(a))
        }

        function isEmpty(a) {
            return "" == trim(a)
        }

        function isInt(a) {
            var b = /^-?[0-9]+$/;
            return b.test(a)
        }

        function SBCCaseToNumberic(a) {
            var c, b = "";
            for (c = 0; c < a.length; c++) b += 12288 != a.charCodeAt(c) ? a.charCodeAt(c) > 65280 && a.charCodeAt(c) < 65375 ?
                String.fromCharCode(a.charCodeAt(c) - 65248) : String.fromCharCode(a.charCodeAt(c)) : String.fromCharCode(a
                                                                                                                          .charCodeAt(c) - 12256);
            return b
        }

        function DBC2SBC(a) {
            var c, d, e, b = a.value;
            if (b.length <= 0) return false;
            for (qstr1 = "ＡＢＣＤＥＦＧＨＩＪＫＭＮＯＰＱＲＳＴＵＶＷＸＹＺａｂｃｄｅｆｇｈｉｊｋｍｎｏｐｑｒｓｔｕｖｗｘｙｚ１２３４５６７８９０［］（）", bstr1 =
                "ABCDEFGHIJKMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz1234567890[]()", d = false, c = 0; c < b.length; c++) e = b
            .charAt(c), -1 != qstr1.indexOf(e) && (b = b.replace(e, bstr1.charAt(qstr1.indexOf(e))), d = true);
            d && (a.value = b)
        }

        function checkEnglish() {
            var d, e, a = window.txtContent.value.replace(/\n|\r/gi, " "),
                b = a.match(/[a-z]+[\s\?\,\.]/gi),
                c = 0;
            b && (c = b.length + 1), d = 0, b = a.match(/[\u4e00-\u9fa5]/gi), b && (d = b.length + 1), e = document
            .getElementById("divEnglish"), c > d && (e.style.display = "", isEnglish = true, window.cbEnglish.checked = true)
        }

        function GetStartDigit(a) {
            var b, c, d, e, f;
            return a = trim(a), b = /^\s*([a-zA-Z]|问题|第)?\s*\d+|\(\d\)+|[\uFF10-\uFF19]+|（[\uFF10-\uFF19]+）/g, c = -1, d = b
            .exec(a), d && (e = d[0], e.length > 1 && (e.charAt(0) >= "a" && e.charAt(0) <= "z" || e.charAt(0) >= "A" && e
            .charAt(0) <= "Z") && (e = e.substr(1)), e = e.replace(/第\s*/, "").replace(/问题\s*/, ""), f =
                SBCCaseToNumberic(e), c = isInt(f) ? toInt(f) : -1), isDigitBig && (b = /^\s*([一二三四五六七八九十]{1,3})/g, d = b
            .exec(a)) ? ChineseNumberToArabicNumber(d[0]) : c
        }

        function StartWithDigit(a) {
            var c, d, e, f, g, h, i, b = GetStartDigit(a);
            if (-1 == b) return IsSample(a);
            if (b >= 3e3) return false;
            if (c = /^\s*\d+\s*[-－—~～]{1,3}\s*\d+/g, c.test(a) || /^\s*\d+[次万%千小年以岁元人本个后级GXM分版]/.test(a)) return false;
            if (b == prevDigit + 1 && !choiceStartWithNumber) {
                if ("matrix" == qType) {
                    if (b == prevMatrixDigit + 1) return false;
                    if (!StartWithQType(a)) return false
                }
                return prevDigit = b, choiceStartWithNumber = false, true
            }
            if (-1 == prevDigit && (prevDigit = b), "matrix" == qType && (prevMatrixDigit = b), c = /\d[\.、]|\(?\d\)|（?\d）/g,
                d = a.match(c), d && d.length >= 2) {
                for (e = true, f = 0; f < d.length; f++) g = d[f], h = toInt(g), 0 != prevChoiceD && (i = h - prevChoiceD, (0 ==
                    i || 1 != h / i - prevChoiceD / i) && (e = false)), prevChoiceD = h;
                if (e) return false;
                prevChoiceD = 0
            }
            return "matrix" != qType || StartWithQType(a) ? (titleProcessed && "cut" != qType && 1 == b && (
                choiceStartWithNumber = true), choiceStartWithNumber ? false : (prevDigit = b, true)) : false
        }

        function ChineseNumberToArabicNumber(a) {
            var c, d, e, f, g, b = /(^[一二三四五六七八九十]$)|(^十[一二三四五六七八九]$)|(^[二三四五六七八九]十?[一二三四五六七八九]{0,1}$)/;
            if (!b.exec(a)) return -1;
            switch (c = -1, d = "", e = "一二三四五六七八九十", f = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], g = a.length) {
                case 1:
                    c = f[e.indexOf(a)];
                    break;
                case 2:
                    "十" != a[0] ? (d = f[e.indexOf(a[0])] + "", d += "十" == a[1] ? "0" : f[e.indexOf(a[1])], c = toInt(d)) : (
                        d = "1", d += f[e.indexOf(a[1])], c = toInt(d));
                    break;
                case 3:
                    d = f[e.indexOf(a[0])] + "", d += f[e.indexOf(a[2])] + "", c = toInt(d)
            }
            return c
        }

        function StartWithQType(a) {
            console.log('------StartWithQType--------')
            return a.contains(MatrixType) || a.contains(LikertMatrixType) || a.contains(RevLikertMatrixType) || a.contains(
                "[矩阵单选题]") || a.contains(SumType) || a.contains(RadioQType) || a.contains(CeShiQType) || a.contains(
                CeShiQCheckType) || a.contains(SortType) || a.contains(TableType) || a.contains(GapFillType) || a.contains(
                GapFillTest) || a.contains(kaoshiBlankType) || a.contains(LikertType) || a.contains(ReverseLikertType) || a
            .contains(CutType) || a.contains(PageType) || IsCut(a) ? true : a.contains(AllQType) ? true : false
        }

        function IsCut(a) {
            var b, c;
            return a = trim(a), b = /^\s*(基本信息|个人信息)/g, b.exec(a) ? true : isDigitBig ? false : (b =
                /^\s*【?([一二三四五六七八九][\.。、\x20\t．:：]|[（(][一二三四五六七八九][)）]|第[一二三四五六七八九])/g, b.exec(a) ? (c = a.match(
                /[一二三四五六七八九]/g).length, c > 2 ? false : true) : false)
        }

        function IsSample(a) {
            if (a = trim(a), a.endWith(":") || a.endWith("："))
                for (var b = 0; b < SampleArray.length; b++)
                    if (a.contains(SampleArray[b])) return true;
            return false
        }

        function IsBlank(a) {
            if (void 0 == a) return false;
            var b = /^(\-|=|_)+$/g;
            return a = trim(a), b.exec(a) ? true : isEmpty(a) || "\n" == a ? true : false
        }

        /**
         * 判断是否数字
         */
        function IsNumber(a) {
            return "0" == a || "1" == a || "2" == a || "3" == a || "4" == a || "5" == a || "6" == a || "7" == a || "8" == a ||
            "9" == a ? true : false
        }

        /**
         * 判断是否多选
         * @param {*} a
         * @returns
         */
        function isCheck(a) {
            console.log('------isCheck--------')
            return isKaoShi ? false : a.contains("单选") ? false : (a.contains("多") || a.contains("复数") || a.contains("限") || a
            .contains("最少") || a.contains("至少")) && a.contains("选") ? true : a.contains("哪些") ? true : false
        }

        function AddQuestion(a, b) {
            console.log('------AddQuestion--------')
            var c, d, e, f, g, h;
            if (a.contains(GapFillStr) || a.match(/[\{｛].*?[\}｝]/)) return AddGapFill(a, b);
            if (c = new Object, c._type = "question", c._topic = b + "", d = false, a.contains(GapFillTest) || a.contains(
                CeShiJianDaType) || isKaoShi) {
                if (c._isCeShi = true, c._ceshiDesc = "", e = /[\(（]?\s*([×错√对])\s*[\)）]?\s*$/, f = a.match(e), f && f[1])
                    return c._type = "radio", c._title = a.replace(e, ""), c._keyword = "", c._relation = "", c._hasvalue = true,
                        c._ceshiDesc = "", c._ceshiValue = 5, c._hasjump = false, c._anytimejumpto = "0", c._requir = true, c._ins =
                        "", c._randomChoice = false, c._verify = "", c._numperrow = 1, c._ispanduan = true, c._select = new Array, c
                    ._select.push(new Object), g = f[1].contains("对") || f[1].contains("√"), h = new Object, h._item_title =
                        "对", h._item_radio = g, h._item_value = "", h._item_jump = "0", h._item_tb = false, h._item_tbr = false, h
                        ._item_img = "", h._item_imgtext = false, h._item_desc = "", h._item_label = "", c._select.push(h), h =
                        new Object, h._item_title = "错", h._item_radio = !g, h._item_value = "", h._item_jump = "0", h
                        ._item_tb = false, h._item_tbr = false, h._item_img = "", h._item_imgtext = false, h._item_desc = "", h
                        ._item_label = "", c._select.push(h), c;
                (a.contains(CeShiJianDaType) || a.contains("[简答题]")) && (c._answer = "简答题无答案", c._ceshiValue = 5, c._height = 3,
                    d = true)
            }
            return c._type = "question", isKaoShi && (c._answer = a.contains(kaoshiBlankType) ? "请设置答案" : "简答题无答案"), c._title =
                ProcessTitle(a.replace(e, "").replace(kaoshiBlankType, "")), c._keyword = "", c._relation = "", c._verify = "",
                c._tag = "", d || (c._height = 1), c._maxword = "", c._requir = false, c._norepeat = false, c._default = "", c._ins =
                "", c._hasjump = false, c._anytimejumpto = "0", c._needOnly = false, c._hasList = false, c._listId = -1, c._width = "", c
                ._underline = false, c._minword = "", c._startLine = lineIndex, c._endLine = lineIndex, c
        }

        function getGapFillCount(a) {
            console.log('------getGapFillCount--------')
            var f, b = 0,
                c = 0,
                d = a.length,
                e = a.match(/(\{.*?\})/g);
            if (e) return e.length;
            do
                if (c = a.indexOf(GapFillStr, c), -1 != c)
                    for (b++, c += GapFillStr.length, f = c; d > f && "_" == a.charAt(f); f++) c++; while (-1 != c);
            return b
        }

        function replaceGapFill(a, b) {
            console.log('------replaceGapFill--------')
            var g, h, i, j, k, l, c = 0,
                d = 0,
                e = new StringBuilder,
                f = 0;
            do
                if (d = c, c = a.indexOf(GapFillStr, c), g = GapFillStr, -1 != c) {
                    for (h = 0, e.append(a.substr(d, c - d)), c += GapFillStr.length, i = c; i < a.length && "_" == a[i]; i++)
                        h++, g += "_", c++;
                    j = GapWidth + h * (GapWidth / 3), k = false, b._rowVerify[f] && "日期" == b._rowVerify[f]._verify && (j = 70,
                        k = true), l = GapFillReplace.replace("width:" + GapWidth + "px", "width:" + j + "px"), l = b
                        ._useTextBox ? l.replace("/>", " class='inputtext'/>") : l.replace("/>", " class='underline'/>"), e
                    .append(l), f++
                } else d < a.length && e.append(a.substr(d)); while (-1 != c);
            return e.toString()
        }

        function AddGapFill(a, b, c) {
            console.log('------AddGapFill--------')
            var f, g, h, i, j, d = getGapFillCount(a),
                e = new Object;
            if (e._type = "gapfill", e._topic = b + "", e._verify = "", (a.contains(GapFillTest) || isKaoShi) && (e._isCeShi = !
                0), a = ProcessTitle(a.replace(kaoshiBlankType, "")), e._title = a, e._keyword = "", e._relation = "", e
                ._tag = "", e._requir = true, e._gapcount = d, e._ins = "", e._hasjump = false, e._anytimejumpto = "0", e
                ._useTextBox = false, e._rowVerify = new Array, isKaoShi)
                if (c) {
                    if (f = c.replace(/(答案|答[：:])\s*/, ""), g = f.split(/[；;]/), d = getGapFillCount(a), h = g.length < d ? g
                        .length : d, h > 0)
                        for (i = 0; h > i; i++) e._rowVerify[i] = new Object, e._rowVerify[i]._answer = trim(g[i]), e
                            ._rowVerify[i]._ceshiValue = 1;
                    a = a.replace(/([\{｛].*?[\}｝])/g, "______"), e._title = a
                } else if (j = a.match(/[\{｛].*?[\}｝]/g), j && j.length > 0) {
                    for (i = 0; i < j.length; i++) e._rowVerify[i] = new Object, e._rowVerify[i]._answer = trim(j[i].replace("{",
                                                                                                                             "").replace("}", "").replace("｛", "").replace("｝", "")), e._rowVerify[i]._ceshiValue = 1;
                    a = a.replace(/([\{｛].*?[\}｝])/g, "______"), e._title = a
                }
            return e._startLine = lineIndex, e._endLine = lineIndex, e
        }

        function AddSelectTitle(a, b, c) {
            console.log('------AddSelectTitle--------')
            var e, f, d = new Object;
            return d._startLine = lineIndex, d._tag = "", "sort" == c ? (d._type = "check", d._tag = "1", a = a.replace(
                SortType, "")) : "likert" == c ? (d._type = "radio", d._tag = "101", a = a.replace(LikertType, "").replace(
                ReverseLikertType, "")) : (d._type = c, a = a.replace(CeShiQType, "").replace(CeShiQCheckType, "")), d
                ._topic = b + "", "check" == c && (e = /限选(\d)项/, f = a.match(e), f && f[1] > 0 && (d._lowLimit = f[1], d
                ._upLimit = f[1], a = a.replace(e, "")), e = /最多选(\d)项/, f = a.match(e), f && f[1] > 0 && (d._upLimit =
                f[1], d._lowLimit = "", a = a.replace(e, "")), e = /[最至]少选(\d)项/, f = a.match(e), f && f[1] > 0 && (d
                ._lowLimit = f[1], d._upLimit = "", a = a.replace(e, ""))), a = ProcessTitle(a), isKaoShi && "radio" == c &&
            a.contains("[判断题]") && (a = a.replace("[判断题]", ""), d._ispanduan = true), d._title = a, d._keyword = "", d
                ._relation = "", d._hasvalue = "likert" == c ? true : false, d._hasjump = false, d._anytimejumpto = "0", d._requir = true,
                d._ins = "", d._randomChoice = false, d._verify = "", numPerNow >= 6 && (numPerNow /= 2), "您的性别：" == a && 1 ==
            numPerNow && (d._verify = "性别", numPerNow = 6), d._numperrow = numPerNow, numPerNow = 1, d._select = new Array,
                d._select.push(new Object), d
        }

        function AddSelectItem(a, b) {
            console.log('------AddSelectItem--------')
            var c, d;
            b = trim(b).replace("□", ""), IsBlank(b) || (c = false, b.endWith(GapFillStr) || b.endWith(GapFillStr + ")") || b
            .endWith(GapFillStr + "）") ? (b = b.replace(/[_]/g, ""), c = true) : (b.contains("请注明") || b.contains(
                "请说明")) && (b = b.replace(/[(（]?(请注明|请说明|请填写)[)）]?/g, ""), c = true), d = new Object, d._item_title = b, d
                ._item_radio = false, d._item_value = "", d._item_jump = "0", d._item_tb = c, d._item_tbr = false, c && (d
                ._item_tbr = true, d._item_tbt = ""), d._item_img = "", d._item_imgtext = false, d._item_desc = "", d
                ._item_label = label || "", label = "", a._select.push(d))
        }

        function AddColumn(a, b) {
            isEmpty(trim(b)) || (a._columntitle ? a._columntitle += "\n" + b : a._columntitle = b)
        }

        function AddMatrixTitle(a, b, c) {
            var d = new Object;
            return d._startLine = lineIndex, d._type = "matrix", d._topic = b + "", d._keyword = "", d._relation = "", d
                ._verify = "", (a.contains(LikertMatrixType) || a.contains(RevLikertMatrixType)) && (c = "101"), a =
                ProcessTitle(a), a = "303" == c ? a.replace(TableType, "") : a.replace(MatrixType, "").replace(LikertMatrixType,
                                                                                                               "").replace(RevLikertMatrixType, "").replace("[矩阵单选题]", ""), d._tag = c, d._title = a, d._hasvalue =
                "303" == c || "101" == c ? true : false, d._hasjump = false, d._anytimejumpto = "0", d._requir = true, d._ins = "", d
                ._rowwidth = "", d._rowwidth2 = "", d._rowtitle = "", d._rowtitle2 = "", d._columntitle = "", d._select =
                new Array, d._select.push(new Object), d
        }

        function AddMatrixLine(a, b) {
            IsBlank(b) || (a._rowtitle || (a._rowtitle = ""), a._rowtitle && (a._rowtitle += "\n"), isEmpty(label) || (a
                ._rowtitle += DesignLabelItem + label + "\n", label = ""), a._rowtitle += b)
        }

        function AddSumTitle(a, b) {
            var c = new Object;
            return c._startLine = lineIndex, c._verify = "", c._type = "sum", c._topic = b + "", c._keyword = "", c._relation =
                "", a = ProcessTitle(a), a = a.replace(SumType, ""), c._title = a, c._tag = "", c._hasjump = false, c
                ._anytimejumpto = "0", c._requir = true, c._ins = "", c._rowwidth = 100, c._total = 100, c
        }

        function ContainsAB(a, b, c, d) {
            var e, f, g, h, i, j, k, l, m;
            return isEnglish ? false : (e = a.toUpperCase(), f = e.indexOf("A"), "A" == e.charAt(0) && c < b.length - 1 && "B" ==
            b[c + 1].toUpperCase().charAt(0) ? false : (g = false, h = false, f > -1 && (g = true, f + 1 < e.length && e.charAt(f +
                                                                                                                                    1) >= "A" && e.charAt(f + 1) <= "Z" && (g = false)), i = false, j = g && !e.contains("AB"), k = /\sB/, l =
                k.test(e), j && l ? true : (j && (f = e.indexOf("B"), f > -1 && (h = true, f + 1 < e.length && e.charAt(f +
                                                                                                                            1) >= "A" && e.charAt(f + 1) <= "Z" && (h = false)), !h && d > c + 1 && (m = b[c + 1]
            .toUpperCase(), f = m.indexOf("B"), f > -1 && (h = true, f + 1 < m.length && m.charAt(f +
                                                                                                      1) >= "A" && m.charAt(f + 1) <= "Z" && (h = false))), h && (i = true)), i)))
        }

        function replace_specialChar(a) {
            return a.replace(/(§)/g, "ξ").replace(/(¤)/g, "○").replace(/(〒)/g, "╤")
        }

        function regsplit(a, b) {
            var f, c = a.split(b),
                d = a.match(b),
                e = [c[0]];
            if (!d) return e;
            for (f = 0; f < d.length; ++f) e[2 * f + 1] = d[f], e[2 * f + 2] = c[f + 1];
            return e
        }

        function ProcessTitleItems(a) {
            console.log('------ProcessTitleItems--------')
            var b, c, d, e, f, g, h, i, j, k, l, m, n;
            if (isEnglish) return false;
            if (b = false, c = null, d = a.toUpperCase(), e = a, f = "radio", isCheck(a) && (f = "check"), g = d.indexOf("A"),
                h = false, i = false, g > -1 && (h = true, g + 1 < d.length && d.charAt(g + 1) > "A" && d.charAt(g + 1) < "Z" && (h = !
                1)), g = d.indexOf("B"), g > -1 && (i = true, g + 1 < d.length && d.charAt(g + 1) > "A" && d.charAt(g + 1) <
            "Z" && (i = false)), j = h && i && !d.contains("AB"), j && !isKaoShi)
                for (c = regsplit(a, /[A-Z][^A-Z]/gi), e = c[0], b = true, numPerNow = (c.length - 1) / 2, tempDataNode =
                    AddSelectTitle(e, qIndex, f), k = 1; k < c.length; k += 2) l = c[k] + c[k + 1], AddSelectItem(tempDataNode,
                                                                                                                  l);
            else if (m = /□|○|①|②|③|④|⑤|⑥|⑦|⑧/gi, c = a.split(m), c.length >= 3) {
                for (numPerNow = c.length - 1, n = e.search(m), e = e.substr(0, n), tempDataNode = AddSelectTitle(e, qIndex, f),
                         k = 1; k < c.length; k += 1) l = c[k], isEmpty(l) || AddSelectItem(tempDataNode, l);
                b = true
            }
            return b
        }

        /**
         * 移除题目中的题型信息
         * @param {*} a
         * @returns
         */
        function ProcessTitle(a) {
            var c, d, b = 0;
            if (a = a.replace("[单选题]", "").replace("[复选题]", "").replace("[多选题]", "").replace("[主观题]", "").replace("[问答题]", "")
                     .replace("[必答题]", "").replace("(可多选)", "").replace("[排序题]", "").replace("(多选)", "").replace("[矩阵题]", "")
                     .replace("[矩阵单选题]", "").replace("[段落说明]", "").replace("[表格题]", "").replace("[比重题]", "").replace("[分页栏]", "")
                     .replace(AllQType, "").replace("[测试填空题]", "").replace(CeShiJianDaType, "").replace("[简答题]", ""), !isCompact &&
            IsNumber(a.charAt(0))) {
                if (!StartWithDigit(a)) return a;
                for (b++, c = 1; c < a.length; c++)
                    if (IsNumber(a.charAt(c))) b++;
                    else {
                        if (d = a.charAt(c), "." != d && "。" != d && "、" != d && " " != d && "．" != d) break;
                        b++
                    } return a.substr(b)
            }
            return a
        }

        function AddCut(a) {
            var c, b = new Object;
            return b._type = "cut", b._title = a.replace(CutType, ""), b._tag = "", b._startLine = cutStartIndex, c = a.split(
                "\n").length, b._endLine = cutStartIndex + c, b
        }

        /**
         * 解析答案
         * @param {*} a
         * @param {*} b
         * @param {*} c
         */
        function processQuesAnswer(a, b, c) {
            var d, e;
            b ? (d = /(解析[：:])\s*/, e = null, e = c.replace(d, ""), a._ceshiDesc = e) : (d = /(答案[：:])\s*/, e = null, e = c
            .replace(d, ""), a._answer = e)
        }

        function control_textarea(a, b) {
            var c = document.createElement("textarea");
            return c.wrap = "soft", c.rows = a, c.style.width = 10 * b + "px", c.style.height = 18 * a + "px", c.className =
                "inputtext", c
        }

        function divQuestionMouseOver() {
            var a, b, c, d;
            curdiv != this && (null != curdiv && (curdiv.style.background = "", a = curdiv.div_ins_question, a && (a.style
                .visibility = "hidden")), curdiv = this, this.style.background = "#F7F8F9", b = this.dataNode,
            isNotClick || (c = b._startLine, d = 20 * c, window.txtContent.scrollTop = d))
        }

        function displayChangeQ(a) {

            console.log('------displayChangeQ--------')
            var b = curdiv.dataNode,
                c = b._startLine - 1,
                d = "<a href='javascript:void(0);' onclick='changeQ(this," + c + ");'>",
                e = "<div style='padding:5px;line-height:20px;'>";
            "question" == b._type ? (e += d + "[段落说明]</a><br/>", e += d + "[分页栏]</a>") : "page" == b._type ? (e += d +
                "[段落说明]</a><br/>", e += d + "[问答题]</a>") : "cut" == b._type ? (e += d + "[问答题]</a><br/>", e += d +
                "[单选题]</a><br/>", e += d + "[分页栏]</a>") : "radio" == b._type ? (e += d + "[多选题]</a><br/>", e += d +
                "[矩阵题]</a><br/>", e += d + "[表格题]</a><br/>", e += d + "[排序题]</a><br/>", e += d + "[比重题]</a>") : "check" == b
                ._type ? (e += d + "[单选题]</a><br/>", e += d + "[矩阵题]</a><br/>", e += d + "[表格题]</a><br/>", e += b._tag ? d +
                "[多选题]</a><br/>" : d + "[排序题]</a><br/>", e += d + "[比重题]</a>") : "matrix" == b._type && (e += d +
                "[单选题]</a><br/>", e += d + "[多选题]</a><br/>"), e += "</div>", toolTipLayer.innerHTML = e, toolTipLayer
                .divQuestion = curdiv, sb_setmenuq(toolTipLayer, true, a)
        }

        function hideChangeQ() {
            sb_setmenuq(toolTipLayer, false)
        }

        function getCoords(a) {
            var b = a.getBoundingClientRect(),
                c = a.ownerDocument,
                d = c.body,
                e = c.documentElement,
                f = e.clientTop || d.clientTop || 0,
                g = e.clientLeft || d.clientLeft || 0,
                h = b.top + (self.pageYOffset || e.scrollTop || d.scrollTop) - f,
                i = b.left + (self.pageXOffset || e.scrollLeft || d.scrollLeft) - g;
            return {
                top: h,
                left: i
            }
        }

        function sb_setmenuq(a, b, c) {
            var f, g, h, i, j, k, l, e = $_js(a);
            b && (e.style.display = "block", e.timeArray && (window.clearTimeout(e.timeArray), e.timeArray = 0), e
                .onmouseover || (e.onmouseover = function () {
                sb_setmenuq(a, true)
            }, e.onmouseout = function () {
                sb_setmenuq(a, false)
            }), c && (f = document.getElementById("main-wrapper"), g = getCoords(f), h = c, "li" == h.parentNode.tagName
                                                                                                     .toLowerCase() && (h = c.parentNode), i = getCoords(h), j = i.left - g.left, k = i.top - g.top + h
                .offsetHeight - 1, l = document.documentElement.clientHeight || document.body.clientHeight, j + e
                .offsetWidth > bodyWidth && (j = bodyWidth - e.offsetWidth - 30), k + e.offsetHeight > l, e.style.left =
                j + "px", e.style.top = k + "px")), b || (e.timeArray = window.setTimeout(function () {
                e.style.display = "none", e.style.height = ""
            }, 100))
        }

        function divQuestionMouseOut() {}

        function divQuestionClick() {}

        function StringBuilder() {
            this._stringArray = new Array
        }

        function cancelInputClick(a) {
            var d, e, f, b = a.div_question_preview,
                c = $$("input", b);
            for (d = 0; d < c.length; d++) c[d].onclick = function () {
                return this.checked ? (this.checked = false, false) : void 0
            }, c[d].onkeydown = function () {
                return this.value = "", false
            };
            for (e = $$("textarea", b), d = 0; d < e.length; d++) e[d].onclick = function () {
                return false
            }, e[d].onchange = function () {
                this.value = ""
            }, e[d].onkeydown = function () {
                return this.value = "", false
            };
            for (f = $$("select", b), d = 0; d < f.length; d++) f[d].onchange = function () {
                return this.selectedIndex = 0, false
            }
        }
        var toolTipLayer, hasInsert, SampleArray, curdiv, MatrixType = "[矩阵题]",
            LikertMatrixType = "[矩阵量表题]",
            RevLikertMatrixType = "[矩阵反向量表题]",
            TableType = "[表格题]",
            SumType = "[比重题]",
            SortType = "[排序题]",
            LikertType = "[量表题]",
            ReverseLikertType = "[反向量表题]",
            LabelItem = "[标签]",
            DesignLabelItem = "【标签】",
            CutType = "[段落说明]",
            PageType = "[分页栏]",
            AllQType = "[题目]",
            CheckQType = "[多选题]",
            RadioQType = "[单选题]",
            GapFillType = "[问答题]",
            GapFillTest = "[测试填空题]",
            CeShiQType = "[测试题]",
            CeShiQCheckType = "[测试多选题]",
            CeShiJianDaType = "[测试简答题]",
            kaoshiBlankType = "[填空题]",
            label = "",
            qType = "",
            isCompact = false,
            GenerateType = 1,
            qIndex = 1,
            itemValue = 0,
            needExcute = false,
            prevDigit = -1,
            prevMatrixDigit = -1,
            numPerNow = 1,
            isNotClick = false,
            total_page = 0,
            tempDataNode = null,
            curPos = 0,
            lineCharCount = 2,
            lineIndex = 0,
            lines = null,
            cutStartIndex = 0,
            cutEndIndex = 0,
            pageStartIndex = 0,
            pageEndIndex = 0,
            isEnglish = false,
            prevChoiceD = 0,
            choiceStartWithNumber = false,
            GapFillStr = "___",
            GapWidth = 21,
            GapFillReplace = "<input style='width:" + GapWidth + "px;' />",
            curChar = 0,
            titleProcessed = false,
            questionHolder = null,
            isDigitBig = false,
            firstQuestion = null,
            qlistNode = null,
            questions = document.getElementById("divQuestion");
        $ce = function (a, b, c) {
            var d = document.createElement(a);
            return b && (d.innerHTML = b), c.appendChild(d), d
        }, $$ = function (a, b) {
            if (b) {
                var c = b.getElementsByTagName(a);
                return c && 0 != c.length ? c : (c = new Array, getbyTagName(b, a, c), c)
            }
            return document.getElementsByTagName(a)
        }, $_js = function (a) {
            return "object" == typeof a ? a : document.getElementById(a)
        }, toolTipLayer = document.getElementById("toolTipLayer"), hasInsert = false, String.prototype.contains = function (a) {
            return -1 != this.indexOf(a)
        }, String.prototype.endWith = function (a) {
            return null == a || "" == a || 0 == this.length || a.length > this.length ? false : this.substring(this.length - a
                .length) == a ? true : false
        }, String.prototype.startWith = function (a) {
            return null == a || "" == a || 0 == this.length || a.length > this.length ? false : this.substr(0, a.length) == a ?
                true : false
        }, window.cbEnglish && (window.cbEnglish.onclick = function () {
            isEnglish = window.cbEnglish.checked
        }), window.txtContent.onpaste = window.txtContent.onchange = function () {
            setTimeout(function () {
                DBC2SBC(window.txtContent), window.txtContent.value = window.txtContent.value.replace(/\</g, "&lt;")
                                                                            .replace(/\>/g, "&gt;"), generateQs(), checkEnglish()
            }, 40)
        }, SampleArray = ["公司", "工作", "薪水", "收入", "部门", "职业", "职别", "年龄", "姓名", "性别", "婚", "学校", "年级", "专业", "院系", "邮件",
                          "Email", "手机", "电话", "地址", "城市"
        ], curdiv = null, StringBuilder.prototype.append = function (a) {
            this._stringArray.push(a)
        }, StringBuilder.prototype.toString = function (a) {
            return a = a || "", this._stringArray.join(a)
        }, StringBuilder.prototype.clear = function () {
            this._stringArray.length = 0
        };
    </script>
    <script type="text/javascript">

        //处理键盘事件 禁止后退键（Backspace）密码或单行、多行文本框除外
        function forbidBackSpace(e) {
            var ev = e || window.event; //获取event对象
            var obj = ev.target || ev.srcElement; //获取事件源
            var t = obj.type || obj.getAttribute('type');
            //当敲Backspace键时，事件源类型为密码或单行、多行文本的，
            var flag2 = ev.keyCode == 8 && t != "password" && t != "text" && t != "textarea";
            if (flag2) return false;
        }
        //禁止后退键  作用于IE、Chrome
        document.onkeydown = forbidBackSpace;

        var defValue = txtContent.value;
        // txtContent.value = defValue
        generateQs();

        txtContent.onclick = function () {
            var value = this.value.replace(/\r/gi, "");
            if (value == defValue)
                this.value = "";
        }
        txtContent.onblur = function () {
            if (!this.value) this.value = defValue;
        }

        /**
         * 转化最终的数据
         * @param a
         * @returns {*}
         */
        function createQBatch(a) {
            console.log('-------createQBatch------')
            var b, c, d, e;
            b = document.createDocumentFragment();
            try {
                for (c = 0; c < qlistNode.length; c++) d = qlistNode[c], e = create_question(d), e.onclick = divQuestionClick, e
                    .onmouseover = divQuestionMouseOver, e.onmouseout = divQuestionMouseOut, b.appendChild(e), questionHolder
                .push(e), firstQuestion || (firstQuestion = e, isNotClick = true, isNotClick = false);
                questions.appendChild(b)
                console.log('-------createQBatch end------')
                const queryList = qlistNode.map(n=>{

                    if ('radio' == n._type||'check' ==  n._type){ // 单选或多选题
                        const answer = n._select.filter(s=>{
                            return s._item_radio
                        }).map(s=>{
                            return s._item_title.trim().substr(0,1)
                        }).join(',')
                        return {
                            ...n,
                            answer
                        }
                    }else if ('question' == n._type){ // 问答题
                        return {
                            ...n,
                            answer:n._answer
                        }
                    }else {
                        return n
                    }
                })
                console.log(queryList)
                $('#examContent').val(JSON.stringify(queryList))
            } catch (f) {
                console.error(f)
                return questions.appendChild(b), divMsg.innerHTML =
                    "<div style='height:10px;'></div>问卷格式不对",
                isKaoShi && (divMsg.innerHTML =
                        "<div style='height:10px;'></div>问卷格式不对"
                ), void 0
            }
        }
    </script>
</html>